/*
 *      ID : pallab81
 *      PROG : 11008
 *      LANG : C++
 *
 *      2012-06-27 08:07:06
 *      "I have not failed, I have just found 10000 ways that won't work.
 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstdlib>

using namespace std;


#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line putchar_unlocked('\n')

template<class T1>
inline void debug(T1 _x) {
    cout<<_x<<'\n';
}
template<class T1, class T2>
inline void debug(T1 _x,T2 _y) {
    cout<<_x<<' '<<_y<<'\n';
}
template<class T1, class T2, class T3>
inline void debug(T1 _x,T2 _y,T3 _z) {
    cout<<_x<<' '<<_y<<' '<<_z<<'\n';
}
template<class T1, class T2, class T3, class T4>
inline void debug(T1 _x,T2 _y,T3 _z,T4 _zz) {
    cout<<_x<<' '<<_y<<' '<<_z<<' '<<_zz<<'\n';
}
template< class T1>
inline void debug(T1 _array,int _size) {
    cout<<"[";
    for (int i=0; i<_size; ++i) {
        cout<<' '<<_array[i];
    }
    puts(" ]");
}

#define getchar getchar_unlocked
#define putchar putchar_unlocked

inline void fastRead(int *a) {
    register char c=0;
    while (c<33) c=getchar();
    *a=0;
    while (c>33)
    {
        *a=*a*10+c-'0';
        c=getchar();
    }
}
inline string fastRead() {
    register char c[33];
    gets(c);
    return (string)c;
}
inline bool CI(int &_x) {
    return scanf("%d",&_x)==1;
}
inline bool CI(int &_x, int &_y) {
    return CI(_x)&&CI(_y) ;
}
inline bool CI(int &_x, int &_y, int &_z) {
    return CI(_x)&&CI(_y)&&CI(_z) ;
}
inline bool CI(int &_x, int &_y, int &_z, int &_zz) {
    return CI(_x)&&CI(_y)&&CI(_z)&&CI(_zz) ;
}
inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while ( clock() < endtime ) {
        ;
    }
}

struct Point {
    int x;
    int y;
    Point(int x=0,int y=0):
            x(x),y(y) {
        ;
    }
};
Point points[16];
int pointCount;
int needCut;

inline void Read() {
    fastRead( &pointCount);
    fastRead( &needCut);

    fo(i,pointCount) {
        CI( points[i].x );
        CI( points[i].y );
    }
}
inline bool Solve(Point a, Point b,Point c) {
    return (a.x*(b.y-c.y))+(b.x*(c.y-a.y))+(c.x*(a.y-b.y))==0 ;
}
const int inf=1023456789;

inline int bc( int msk ) {
    return __builtin_popcount(msk);
}
inline void show() {

}
int dp[1<<16];
bool vis[1<<16];

inline int OR(int msk,int i) {
    return ( msk|(1<<i) );
}
inline int AND(int msk, int i) {
    return ( msk&(1<<i) );
}
inline bool Selected(int msk, int i) {
    return AND(msk,i) ? true : false ;
}

vector<int> E[20];
inline void build() {
    fo(i,20) {
        E[i].clear();
    }
    fo(i,pointCount) {
        int msk=(1<<i);
        fo(j,pointCount) {
            if (i==j)continue;
            int nmsk=msk;
            nmsk|=(1<<j);
            fo(k,pointCount) {
                if (i!=k&&j!=k) {
                    if ( Solve(points[i],points[j],points[k]) ) {
                        nmsk|=(1<<k);
                    }
                }
            }
            E[i].pb(nmsk);
        }
    }
}

int go(int msk) {
    int bt=bc(msk);
    if (bt>=needCut)return 0;
    if (bt+1>=needCut)return 1;
    if (bt+2>=needCut)return 1;

    if (vis[msk])return dp[msk];
    vis[msk]=true;
    int res=inf;

    fo(i,pointCount) {
        foit(it,E[i]) {
            if ( ( msk&(*it) )==0 ) {
                res=min(res, 1+go(msk|(*it)) );
            }
        }
    }

    return dp[msk]=res;
}
inline void Solve() {
    build();

    SET(vis,false);
    int v= go( 0 );
    cout<<v<<"\n";
}

#define showcase
int main() {
    int tt;
    CI(tt);
    foE(i,1,tt) {
#ifdef showcase
        cout<<"Case #"<<i<<":\n";
#endif
        Read();
        Solve();
        if (i!=tt)cout<<'\n';
    }

    return 0;
}
// kate: indent-mode cstyle; space-indent on; indent-width 0; 




